package com.jason.login.service.impl;

import com.jason.login.dao.ResumeDao;
import com.jason.login.pojo.Resume;
import com.jason.login.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;


    @Override
    public void addResume(Resume resume) {
        resumeDao.save(resume);
    }

    @Override
    public void updateById(Resume resume) {
        resumeDao.save(resume);
    }

    @Override
    public void deleteById(Resume resume) {
        resumeDao.deleteById(resume.getId());
    }

    @Override
    public List<Resume> queryAll() {
        return resumeDao.findAll();
    }

    @Override
    public Resume queryById(Long id) {
        Optional<Resume> optional = resumeDao.findById(id);
        return optional.isPresent() ? optional.get() : null;
    }
}
